package com.baidu.controller;

import com.baidu.service.TbShopAuditService;
import com.baidu.utils.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 宋金航
 * 商家审核
 */
@RestController
@CrossOrigin
@RequestMapping("shopAudit")
public class ShopAuditController {

    @Autowired
    private TbShopAuditService tbShopAuditService;

    /**
     * 分页模糊
     * @param page
     * @param size
     * @param name  公司名称
     * @param name2   店铺名称
     * @return
     */
    @GetMapping("findList/{page}/{size}")
    public ResultResponse findList(@PathVariable("page")Integer page,
                                   @PathVariable("size")Integer size,
                                   String name,String name2){
        //直接调业务层
        return this.tbShopAuditService.findList(page,size,name,name2);
    }

    /**
     * 根据ID查询详情
     * @param id
     * @return
     */
    @GetMapping("findById/{id}")
    public ResultResponse findById(@PathVariable("id")Integer id){
        return this.tbShopAuditService.findById(id);
    }

    /**
     * 审核通过
     * @param id
     * @return
     */
    @GetMapping("auditPass/{id}")
    public ResultResponse auditPass(@PathVariable("id")Integer id){
        return this.tbShopAuditService.auditPass(id);
    }

    /**
     * 审核拒绝
     * @param id
     * @return
     */
    @GetMapping("auditRefuse/{id}")
    public ResultResponse auditRefuse(@PathVariable("id")Integer id){
        return this.tbShopAuditService.auditRefuse(id);
    }
}
